#	coding : utf-8
require	"rubygems"
require	"watir"
require	"test/unit"
require	"win32ole"
class	Open_tc	<	Test::Unit::TestCase
	def	print_url(url)
#		puts url
			
	end
	def	setup
		@ff	=	FireWatir::Firefox.new
		#url	=	"http://open.shouji.baidu.com/?page=miopen"
		#url="http://db-wise-rdtf0.db01.baidu.com:8080/?page=miopen"
		url="http://tc-wise-rc-tf10.vm.baidu.com:8088/?page=miopen"
		@ff.goto url
	end
	
	def	test_login
		#if not @ff.div(:id,"usrbar_info").link(:text,"登录").exist?
		#	@ff.div(:id,"usrbar_info").link(:text,"退出").click
		#end
		#p ff.div(:id,"usrbar_info").link(:index,1).text
		sleep(1)
		@ff.text_field(:id,"PassInputUsername0").set "souldak_20"
		@ff.text_field(:id,"PassInputPassword0").set "sunli"
		@ff.button(:type,"submit").click
		assert @ff.div(:id,"PassFormWapper0").p(:id,"PassError0").text.eql?	"用户不存在"
		@ff.div(:id,"usrbar_info").link(:text,"登录").click
		@ff.text_field(:id,"PassInputUsername0").set "sunlysunny"
		@ff.text_field(:id,"PassInputPassword0").set "sunli2012"
		@ff.button(:type,"submit").click
		@ff.div(:id,"usrbar_info").link(:text,"退出").click
		#@ff.div(:id,"usrbar_info").link(:text,"登录").click
		@ff.text_field(:id,"PassInputUsername0").set "sunlysunny"
		@ff.text_field(:id,"PassInputPassword0").set "sunli"
		@ff.button(:type,"submit").click
		assert @ff.div(:id,"PassFormWapper0").p(:id,"PassError0").text.eql?	"登录密码错误，请重新登录。"	
	end			
	def	teardown	
		#@ff.close 	
	end
	
end